package com.hzhq.contract.repo;

import com.hzhq.contract.bean.entity.Contract;
import com.hzhq.contract.bean.entity.ContractStatus;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * @author: hzhq1255
 * @mail: hzhq1255@163.com
 * @date: 2021/4/19 0:00
 * @desc:
 */
@Repository
public interface ContractStatusRepository extends MongoRepository<ContractStatus, ObjectId> {

    Optional<ContractStatus> findByStatusIdAndDeleted(ObjectId id, Integer deleted);

    Optional<ContractStatus> findByStatusNameAndDeleted(String name,Integer deleted);

    Optional<ContractStatus> findByContractIdAndStatusNameAndDeleted(ObjectId contractId, String statusName, Integer deleted);

    Optional<ContractStatus> findByContractIdAndStatusIdAndDeleted(ObjectId contractId, ObjectId statusId, Integer deleted);

    List<ContractStatus> findAllByDeleted(Integer deleted);

    Page<ContractStatus> findAllByDeleted(Integer deleted, Pageable pageable);


    Page<ContractStatus> findByStatusNameLikeAndDeleted(String name, Integer deleted,Pageable pageable);
    
    List<ContractStatus> findByStatusIdInAndDeleted(List<ObjectId> ids,Integer deleted);

    

}
